package main

import (
	"crypto/md5"
	"encoding/base64"
	"encoding/hex"
	"fmt"
)

func compute(n int) int {
	if n <= 1 {
		return 1
	}
	return compute(n-1) * n
}

func computMD5(str string) string {
	md := md5.New()
	md.Write([]byte(str))
	result := hex.EncodeToString(md.Sum(nil))
	return result
}

func base64compute(str string) string {
	return base64.StdEncoding.EncodeToString([]byte(str))
}

func decodeBase64(str string) string {
	bytesArry, _ := base64.StdEncoding.DecodeString(str)
	return string(bytesArry)
}
func main() {
	// 4 * 3 * 2 * 1
	fmt.Println(compute(4))
	fmt.Println(computMD5("hello"))

	fmt.Println(base64compute("hello"))

	fmt.Println(decodeBase64("aGVsbG8="))
}
